﻿Imports VN.INS.DL.DH
Imports VN.INS.BL.BE
Imports System.Data

Public Class MantenimientoPoaDA
    Public Function Lista_Monitoreador(ByVal strCodPPER As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = "SELECT per.PERSONA, per.NOMBRES || ' ' || per.APELLIDO_PATERNO AS NOMBRES " & _
                        "FROM persona per INNER JOIN usuario U ON per.USUARIO = U.USUARIO  " & _
                        "WHERE U.perfil='MO' AND " & _
                                   "Per.Pper = '" & strCodPPER & "' " & _
                        "ORDER BY per.NOMBRES"

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function Lista_Especialista(ByVal strCodPPER As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = "SELECT per.PERSONA, per.NOMBRES || ' ' || per.APELLIDO_PATERNO AS NOMBRES " & _
                        "FROM persona per INNER JOIN usuario U ON per.USUARIO = U.USUARIO  " & _
                        "WHERE U.perfil='EP' AND " & _
                                   "Per.Pper = '" & strCodPPER & "' " & _
                        "ORDER BY per.NOMBRES"

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function ListaEspecialistaMantPoa(ByVal strCodPPER As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = "SELECT per.PERSONA, per.NOMBRES || ' ' || per.APELLIDO_PATERNO AS NOMBRES " & _
                        "FROM persona per INNER JOIN usuario U ON per.USUARIO = U.USUARIO  " & _
                        "WHERE U.perfil='EP' AND " & _
                                   "Per.Pper = '" & strCodPPER & "' " & _
                        "ORDER BY per.NOMBRES"

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function lista_ejecutor() As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = " select ejecutor,descripcion from ejecutor order by descripcion "

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function


    Public Function lista_ambito() As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = " SELECT  CODIGO,DESCRIPCION FROM general WHERE id='AMBITO' "

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function



    Public Function Lista_Unidades() As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try
            lxc_SQL = " select unidad,descripcion from unidad order by descripcion "

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function lista_departamento() As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = " SELECT ubigeo,nombre,departamento FROM ubigeo ub WHERE ub.PROVINCIA='00' and ub.DISTRITO='00' ORDER BY NOMBRE "

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function lista_provincia(ByVal strUbigeo As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try
            lxc_SQL = " SELECT ubigeo,nombre,provincia FROM ubigeo ub WHERE  ub.DISTRITO='00' and ub.DEPARTAMENTO= SUBSTR('" + strUbigeo + "',1,2) AND PROVINCIA <> '00' ORDER BY NOMBRE "
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function lista_distrito(ByVal strUbigeo As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = " SELECT ubigeo,nombre FROM ubigeo ub WHERE ub.DEPARTAMENTO= SUBSTR('" + strUbigeo + "',1,2) and ub.PROVINCIA= SUBSTR('" + strUbigeo + "',3,2) AND DISTRITO <> '00' ORDER BY NOMBRE"

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function tipo_cambio() As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = " select CODIGO,DESCRIPCION from GENERAL WHERE ID='TIPO_CAMBIO' "

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function lista_producto(ByVal ppr As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = "SELECT producto,descripcion, num_producto FROM PRODUCTO where pper='" + ppr + "' ORDER BY num_producto "

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function cargarGrilla() As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String
        Try
            lxc_SQL = "SELECT P.NOMBRE, P.MONTO_TOTAL_INVERTIDO, P.MONTO_INV_ANHIO, P.NUM_BENEFICIARIOS_DIRECTOS,PM.NOMBRES || ' ' || PM.APELLIDO_PATERNO || ' ' || PM.APELLIDO_MATERNO AS MONITOREADOR, " & _
                      "PE.NOMBRES || ' ' || PE.APELLIDO_PATERNO || ' ' || PE.APELLIDO_MATERNO AS ESPECIALISTA, P.OBJETIVO,P.SNIP,P.FECHA_VIABILIDAD, P.POA ,U.NOMBRE AS UBIGEO, TPA.DESCRIPCION,PP. ABREVIATURA FROM POA P " & _
                      "INNER JOIN TIPO_PROYECTO_ACTIVIDAD TPA ON TPA.TIPO_PROYECTO_ACTIVIDAD = P.TIPO_PROYECTO_ACTIVIDAD INNER JOIN PPER PP ON PP.PPER = P.PPER " & _
                      "LEFT JOIN PERSONA PM ON PM.PERSONA = P.PERSONA_MONITOREO " & _
                      "LEFT JOIN PERSONA PE ON PE.PERSONA = P.PERSONA_ESPECIALISTA " & _
                      "LEFT JOIN UBIGEO  U ON U.UBIGEO = P.UBIGEO "
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub editar_poa_componente(ByVal poa As String, ByVal comp As String, ByVal Descripcion As String, ByVal version As String, ByVal pesocomp As String)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try

            objData.CreateInputOracle("POAX", poa, 8)
            objData.CreateInputOracle("COMPOX", comp, 8)
            objData.CreateInputOracle("DESCRIPX", Descripcion, 1000)
            objData.CreateInputOracle("VERSX", version, 5)
            objData.CreateInputOracle("PESOCOMP", pesocomp, 5)

            objData.ExecuteOracle_NonQuery("EDITAR_POA_COMPONENTE", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub editar_poa_financiero(ByVal GENE As String, ByVal ESPEC As String, ByVal version As Integer, ByVal IDPFN As Integer,
                                         ByVal MT1 As Decimal, ByVal MT2 As Decimal, ByVal MT3 As Decimal, ByVal MT4 As Decimal, ByVal MT5 As Decimal, ByVal MT6 As Decimal,
                                         ByVal MT7 As Decimal, ByVal MT8 As Decimal, ByVal MT9 As Decimal, ByVal MT10 As Decimal, ByVal MT11 As Decimal, ByVal MT12 As Decimal,
                                         ByVal MTAF As Decimal, ByVal MT As Decimal, ByVal MEAA As Decimal, ByVal EJECUTORA As Decimal, ByVal DEVIDA As Decimal, ByVal OTROS As Decimal)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try

            objData.CreateInputOracle("GENE", GENE, 20)
            objData.CreateInputOracle("ESPEC", ESPEC, 20)
            objData.CreateInputOracle("VERS", Convert.ToDouble(version), 20)
            objData.CreateInputOracle("IDPFN", Convert.ToDouble(IDPFN), 20)
            objData.CreateInputOracle("MT1", Convert.ToDouble(MT1), 20)
            objData.CreateInputOracle("MT2", Convert.ToDouble(MT2), 20)
            objData.CreateInputOracle("MT3", Convert.ToDouble(MT3), 20)
            objData.CreateInputOracle("MT4", Convert.ToDouble(MT4), 20)
            objData.CreateInputOracle("MT5", Convert.ToDouble(MT5), 20)
            objData.CreateInputOracle("MT6", Convert.ToDouble(MT6), 20)
            objData.CreateInputOracle("MT7", Convert.ToDouble(MT7), 20)
            objData.CreateInputOracle("MT8", Convert.ToDouble(MT8), 20)
            objData.CreateInputOracle("MT9", Convert.ToDouble(MT9), 20)
            objData.CreateInputOracle("MT10", Convert.ToDouble(MT10), 20)
            objData.CreateInputOracle("MT11", Convert.ToDouble(MT11), 20)
            objData.CreateInputOracle("MT12", Convert.ToDouble(MT12), 20)
            objData.CreateInputOracle("MTAF", Convert.ToDouble(MTAF), 20)
            objData.CreateInputOracle("MT", Convert.ToDouble(MT), 20)
            objData.CreateInputOracle("MEAA", Convert.ToDouble(MEAA), 20)
            objData.CreateInputOracle("EJE", Convert.ToDouble(EJECUTORA), 20)
            objData.CreateInputOracle("DEV", Convert.ToDouble(DEVIDA), 20)
            objData.CreateInputOracle("OTR", Convert.ToDouble(OTROS), 20)

            objData.ExecuteOracle_NonQuery("EDITAR_POA_ACT_FINANCIERO2", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub editar_poa_fisico(ByVal comp As String, ByVal Descripcion As String, ByVal version As Integer, ByVal unidad As String, ByVal IDPF As Integer,
                                        ByVal MT1 As Decimal, ByVal MT2 As Decimal, ByVal MT3 As Decimal, ByVal MT4 As Decimal, ByVal MT5 As Decimal, ByVal MT6 As Decimal,
                                        ByVal MT7 As Decimal, ByVal MT8 As Decimal, ByVal MT9 As Decimal, ByVal MT10 As Decimal, ByVal MT11 As Decimal, ByVal MT12 As Decimal,
                                        ByVal MTA As Decimal, ByVal PESO As Integer, ByVal COD As String, ByVal MT As Decimal, ByVal MEAA As Decimal)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try

            objData.CreateInputOracle("COMP", comp, 200)
            objData.CreateInputOracle("TDESC", Descripcion, 200)
            objData.CreateInputOracle("VERS", version, 20)
            objData.CreateInputOracle("UND", unidad, 20)
            objData.CreateInputOracle("IDPF", IDPF, 20)
            objData.CreateInputOracle("MT1", MT1, 20)
            objData.CreateInputOracle("MT2", MT2, 20)
            objData.CreateInputOracle("MT3", MT3, 20)
            objData.CreateInputOracle("MT4", MT4, 20)
            objData.CreateInputOracle("MT5", MT5, 20)
            objData.CreateInputOracle("MT6", MT6, 20)
            objData.CreateInputOracle("MT7", MT7, 20)
            objData.CreateInputOracle("MT8", MT8, 20)
            objData.CreateInputOracle("MT9", MT9, 20)
            objData.CreateInputOracle("MT10", MT10, 20)
            objData.CreateInputOracle("MT11", MT11, 20)
            objData.CreateInputOracle("MT12", MT12, 20)
            objData.CreateInputOracle("MTA", MTA, 20)
            objData.CreateInputOracle("PESOX", PESO, 20)
            objData.CreateInputOracle("COD", COD, 10)
            objData.CreateInputOracle("MT", MT, 20)
            objData.CreateInputOracle("MEAA", MEAA, 20)
            objData.ExecuteOracle_NonQuery("EDITAR_POA_ACT_FISICO2", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub editar_poa_principal(ByVal tipCamb As String, ByVal ejec As String, ByVal doc As String, ByVal VERS As Integer, ByVal POA1 As String,
                                    ByVal nomb As String, ByVal obj As String,
                                    ByVal Desc_mt1 As String, ByVal mt1 As Decimal, ByVal umt1 As String,
                                    ByVal Desc_mt2 As String, ByVal mt2 As Decimal, ByVal umt2 As String,
                                    ByVal Desc_mt3 As String, ByVal mt3 As Decimal, ByVal umt3 As String,
                                    ByVal monto As Decimal, ByVal montoaño As Decimal,
                                    ByVal añofirm As String, ByVal monitoreador As String, ByVal espec As String, ByVal mesfirm As String,
                                    ByVal dpto As String, ByVal tipodoc As String, ByVal snip As String, ByVal fviabilidad As String,
                                    ByVal convenio As String, ByVal ambit As String, ByVal estado As String, ByVal pper As String,
                                    ByVal produc As String, ByVal MontTrans As Decimal, ByRef TipoAsig As String, ByVal TipoProyDes As String,
                                    ByVal COORDX As String, ByVal COORDY As String, ByVal OBS As String, ByVal periodoIni As String,
                                    ByVal periodoFin As String, ByVal montoRO As String, ByVal montoDT As String, ByVal EstadoIngreso As String)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try
            objData.CreateInputOracle("POAX", POA1, 20)
            objData.CreateInputOracle("NOM", nomb, 500)
            objData.CreateInputOracle("UBIG", dpto, 20)
            objData.CreateInputOracle("OBJ", obj, 1000)
            objData.CreateInputOracle("SNIPX", snip, 20)
            objData.CreateInputOracle("TipProAct", tipodoc, 20)
            objData.CreateInputOracle("FecViab", fviabilidad, 20)
            objData.CreateInputOracle("Conv", convenio, 20)
            objData.CreateInputOracle("Produc", produc, 20)
            objData.CreateInputOracle("Estd", estado, 20)
            objData.CreateInputOracle("PPERX", pper, 20)
            objData.CreateInputOracle("Ambit", ambit, 20)
            objData.CreateInputOracle("Ejec", ejec, 20)
            objData.CreateInputOracle("MontoInvTot", monto, 20)
            objData.CreateInputOracle("MontoInvAn", montoaño, 20)
            objData.CreateInputOracle("Monit", monitoreador, 20)
            objData.CreateInputOracle("Espec", espec, 20)
            objData.CreateInputOracle("AnFirma", añofirm, 20)
            objData.CreateInputOracle("MesFirma", mesfirm, 20)

            objData.CreateInputOracle("DESC_M1", Desc_mt1, 200)
            objData.CreateInputOracle("MET1", mt1, 20)
            objData.CreateInputOracle("UND1", umt1, 20)

            objData.CreateInputOracle("DESC_M2", Desc_mt2, 200)
            objData.CreateInputOracle("MET2", mt2, 20)
            objData.CreateInputOracle("UND2", umt2, 20)

            objData.CreateInputOracle("DESC_M3", Desc_mt3, 200)
            objData.CreateInputOracle("MET3", mt3, 20)
            objData.CreateInputOracle("UND3", umt3, 20)

            objData.CreateInputOracle("DOC", doc, 20)
            objData.CreateInputOracle("MontTrans", MontTrans, 20)
            objData.CreateInputOracle("TipoAsig", TipoAsig, 2)
            objData.CreateInputOracle("TipoProyDes", TipoProyDes, 2)
            objData.CreateInputOracle("VER", VERS, 2)
            objData.CreateInputOracle("COOX", COORDX, 20)
            objData.CreateInputOracle("COOY", COORDY, 20)
            objData.CreateInputOracle("OBS", OBS, 500)
            objData.CreateInputOracle("PeriodoIni", periodoIni, 20)
            objData.CreateInputOracle("PeriodoFin", periodoFin, 20)
            objData.CreateInputOracle("MontoRO", montoRO, 20)
            objData.CreateInputOracle("MontoDT", montoDT, 20)
            objData.CreateInputOracle("ESTADOINGRESO", EstadoIngreso, 30)

            objData.ExecuteOracle_NonQuery("EDITAR_POA_PRINCIPAL", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub


    Public Sub insertar_poa(ByVal tipCamb As String, ByVal ejec As String, ByVal doc As String, ByVal VERS As Integer, ByVal POA1 As String,
                            ByVal nomb As String, ByVal obj As String,
                            ByVal Desc_mt1 As String, ByVal mt1 As Decimal, ByVal umt1 As String,
                            ByVal Desc_mt2 As String, ByVal mt2 As Decimal, ByVal umt2 As String,
                            ByVal Desc_mt3 As String, ByVal mt3 As Decimal, ByVal umt3 As String,
                            ByVal monto As Decimal, ByVal montoaño As Decimal,
                            ByVal añofirm As String, ByVal monitoreador As String, ByVal espec As String, ByVal mesfirm As String,
                            ByVal dpto As String, ByVal tipodoc As String, ByVal snip As String, ByVal fviabilidad As String, ByVal convenio As String,
                            ByVal ambit As String, ByVal estado As String, ByVal pper As String, ByVal produc As String, ByVal MontTrans As Decimal,
                            ByRef TipoAsig As String, ByVal TipoProyDes As String, ByVal COOX As String, ByVal COOY As String, ByVal OBS As String,
                            ByVal periodoIni As String, ByVal periodoFin As String, ByVal montoRO As String, ByVal montoDT As String, ByVal EstadoIngreso As String)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try
            objData.CreateInputOracle("POAX", POA1, 20)
            objData.CreateInputOracle("NOM", nomb, 500)
            objData.CreateInputOracle("UBIG", dpto, 20)
            objData.CreateInputOracle("OBJ", obj, 1000)
            objData.CreateInputOracle("SNIPX", snip, 20)
            objData.CreateInputOracle("TipProAct", tipodoc, 20)
            objData.CreateInputOracle("FecViab", fviabilidad, 20)
            objData.CreateInputOracle("Conv", convenio, 20)
            objData.CreateInputOracle("Produc", produc, 20)
            objData.CreateInputOracle("Estd", estado, 20)
            objData.CreateInputOracle("PPERX", pper, 20)
            objData.CreateInputOracle("Ambit", ambit, 20)
            objData.CreateInputOracle("Ejec", ejec, 20)
            objData.CreateInputOracle("MontoInvTot", monto, 20)
            objData.CreateInputOracle("MontoInvAn", montoaño, 20)
            objData.CreateInputOracle("Monit", monitoreador, 20)
            objData.CreateInputOracle("Espec", espec, 20)
            objData.CreateInputOracle("AnFirma", añofirm, 20)
            objData.CreateInputOracle("MesFirma", mesfirm, 20)
            objData.CreateInputOracle("TipCamb", tipCamb, 20)

            objData.CreateInputOracle("DESC_META1", Desc_mt1, 200)
            objData.CreateInputOracle("MET1", mt1, 20)
            objData.CreateInputOracle("UND1", umt1, 20)

            objData.CreateInputOracle("DESC_META2", Desc_mt2, 200)
            objData.CreateInputOracle("MET2", mt2, 20)
            objData.CreateInputOracle("UND2", umt2, 20)

            objData.CreateInputOracle("DESC_META3", Desc_mt3, 200)
            objData.CreateInputOracle("MET3", mt3, 20)
            objData.CreateInputOracle("UND3", umt3, 20)

            objData.CreateInputOracle("VERS", VERS, 20)
            objData.CreateInputOracle("DOC", doc, 20)
            objData.CreateInputOracle("MontTrans", MontTrans, 20)
            objData.CreateInputOracle("TipoAsig", TipoAsig, 2)
            objData.CreateInputOracle("TipoProyDes", TipoProyDes, 2)
            objData.CreateInputOracle("COOX", COOX, 20)
            objData.CreateInputOracle("COOY", COOY, 20)
            objData.CreateInputOracle("OBS", OBS, 500)
            objData.CreateInputOracle("PeriodoIni", periodoIni, 20)
            objData.CreateInputOracle("PeriodoFin", periodoFin, 20)
            objData.CreateInputOracle("MontoRO", montoRO, 20)
            objData.CreateInputOracle("MontoDT", montoDT, 20)
            objData.CreateInputOracle("ESTADOINGRESO", EstadoIngreso, 30)

            objData.ExecuteOracle_NonQuery("INSERT_POA", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub insertar_componente(ByVal poa As String, ByVal comp As String, ByVal Descripcion As String, ByVal version As String, ByVal comph As Integer, ByVal pesocomp As Integer)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try

            objData.CreateInputOracle("POAX", poa, 20)
            objData.CreateInputOracle("compo", comp, 20)
            objData.CreateInputOracle("descrip", Descripcion, 1000)
            objData.CreateInputOracle("VERS", version, 20)
            objData.CreateInputOracle("compoh", comph, 20)
            objData.CreateInputOracle("PESOCOMP", pesocomp, 20)

            objData.ExecuteOracle_NonQuery("insert_componente", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub insertar_actividad_fisica(ByVal poa As String, ByVal comp As String, ByVal Descripcion As String, ByVal version As String, ByVal unidad As String, ByVal IDPF As Integer,
                                        ByVal MT1 As Decimal, ByVal MT2 As Decimal, ByVal MT3 As Decimal, ByVal MT4 As Decimal, ByVal MT5 As Decimal, ByVal MT6 As Decimal,
                                        ByVal MT7 As Decimal, ByVal MT8 As Decimal, ByVal MT9 As Decimal, ByVal MT10 As Decimal, ByVal MT11 As Decimal, ByVal MT12 As Decimal,
                                        ByVal MTA As Decimal, ByVal IDFH As Integer, ByVal IDPC As Integer, ByVal PESO As Integer, ByVal COD As String, ByVal MT As Decimal, ByVal MEAA As Decimal)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try

            objData.CreateInputOracle("POAX", poa, 20)
            objData.CreateInputOracle("COMP", comp, 200)
            objData.CreateInputOracle("TDESC", Descripcion, 200)
            objData.CreateInputOracle("VERS", version, 20)
            objData.CreateInputOracle("UND", unidad, 20)
            objData.CreateInputOracle("IDPF", IDPF, 20)
            objData.CreateInputOracle("MT1", MT1, 20)
            objData.CreateInputOracle("MT2", MT2, 20)
            objData.CreateInputOracle("MT3", MT3, 20)
            objData.CreateInputOracle("MT4", MT4, 20)
            objData.CreateInputOracle("MT5", MT5, 20)
            objData.CreateInputOracle("MT6", MT6, 20)
            objData.CreateInputOracle("MT7", MT7, 20)
            objData.CreateInputOracle("MT8", MT8, 20)
            objData.CreateInputOracle("MT9", MT9, 20)
            objData.CreateInputOracle("MT10", MT10, 20)
            objData.CreateInputOracle("MT11", MT11, 20)
            objData.CreateInputOracle("MT12", MT12, 20)
            objData.CreateInputOracle("MTA", MTA, 20)
            objData.CreateInputOracle("IDFH", IDFH, 20)
            objData.CreateInputOracle("IDPC", IDPC, 20)
            objData.CreateInputOracle("PESOX", PESO, 20)
            objData.CreateInputOracle("COD", COD, 10)
            objData.CreateInputOracle("MT", MT, 20) 'NUEVOS CAMPOS by sensey
            objData.CreateInputOracle("MEAA", MEAA, 20)
            objData.ExecuteOracle_NonQuery("insert_actividad_fisica", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub insertar_actividad_financiera(ByVal poa As String, ByVal GENE As String, ByVal ESPEC As String, ByVal version As Integer, ByVal IDPFN As Integer,
                                         ByVal MT1 As Decimal, ByVal MT2 As Decimal, ByVal MT3 As Decimal, ByVal MT4 As Decimal, ByVal MT5 As Decimal, ByVal MT6 As Decimal,
                                         ByVal MT7 As Decimal, ByVal MT8 As Decimal, ByVal MT9 As Decimal, ByVal MT10 As Decimal, ByVal MT11 As Decimal, ByVal MT12 As Decimal,
                                         ByVal MTAF As Decimal, ByVal IDFNH As Integer, ByVal MT As Decimal, ByVal MEAA As Decimal, ByVal EJECUTORA As Decimal, ByVal DEVIDA As Decimal, ByVal OTROS As Decimal)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try

            objData.CreateInputOracle("POAX", poa, 8)
            objData.CreateInputOracle("GENE", GENE, 10)
            objData.CreateInputOracle("ESPEC", ESPEC, 20)
            objData.CreateInputOracle("VERS", version, 20)
            objData.CreateInputOracle("IDPFN", IDPFN, 20)
            objData.CreateInputOracle("MT1", MT1, 20)
            objData.CreateInputOracle("MT2", MT2, 20)
            objData.CreateInputOracle("MT3", MT3, 20)
            objData.CreateInputOracle("MT4", MT4, 20)
            objData.CreateInputOracle("MT5", MT5, 20)
            objData.CreateInputOracle("MT6", MT6, 20)
            objData.CreateInputOracle("MT7", MT7, 20)
            objData.CreateInputOracle("MT8", MT8, 20)
            objData.CreateInputOracle("MT9", MT9, 20)
            objData.CreateInputOracle("MT10", MT10, 20)
            objData.CreateInputOracle("MT11", MT11, 20)
            objData.CreateInputOracle("MT12", MT12, 20)
            objData.CreateInputOracle("MTAF", MTAF, 20)
            objData.CreateInputOracle("IDFNH", IDFNH, 20)
            objData.CreateInputOracle("MT", MT, 20)
            objData.CreateInputOracle("MEAA", MEAA, 20)
            objData.CreateInputOracle("EJE", EJECUTORA, 20)
            objData.CreateInputOracle("DEV", DEVIDA, 20)
            objData.CreateInputOracle("OTR", OTROS, 20)
            objData.ExecuteOracle_NonQuery("insert_actividad_financiera", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Function CargarGrillaHistory(ByVal poa As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String
        Try
            lxc_SQL = "select PH.poa ,PH.NOMBRE,PH.VERSION,UB.NOMBRE Ubigeo,PH.OBJETIVO,PH.SNIP,TPA.DESCRIPCION as tipo_poa, " + _
                    " PH.FECHA_VIABILIDAD, cn.NOMBRE CONVENIO, PD.DESCRIPCION PRODUCTO,   " + _
                    " GNRL2.DESCRIPCION AS ESTADO,PPER.ABREVIATURA PPER,PH.AMBITO, EJEC.DESCRIPCION EJECUTOR,   PH.MONTO_TOTAL_INVERTIDO, " + _
                    " PH.MONTO_INV_ANHIO,PM.NOMBRES || ' ' || PM.APELLIDO_PATERNO || ' ' || PM.APELLIDO_MATERNO AS MONITOREADOR, " + _
                    " PE.NOMBRES || ' ' || PE.APELLIDO_PATERNO || ' ' || PE.APELLIDO_MATERNO AS ESPECIALISTA,  " + _
                    "  PH.ANHIO_FIRMA_POA, PH.MES_FIRMA_POA, PH.TIPO_CAMBIO_POA,GNRL.DESCRIPCION AS TIPO_CAMBIO, PH.META, U.DESCRIPCION unidad1, " + _
                    " PH.META2, U2.DESCRIPCION unidad2,  PH.META3, U3.DESCRIPCION unidad3, PH.DOCUMENTO  " + _
                    " from POA_HISTORICO PH  " + _
                    " LEFT JOIN UBIGEO UB ON PH.UBIGEO=UB.UBIGEO  " + _
                    " LEFT JOIN TIPO_PROYECTO_ACTIVIDAD TPA ON PH.TIPO_PROYECTO_ACTIVIDAD=TPA.TIPO_PROYECTO_ACTIVIDAD " + _
                    " left JOIN CONVENIO   cn on cn.CONVENIO = PH.CONVENIO  " + _
                    " LEFT JOIN PRODUCTO PD ON PD.PRODUCTO = PH.PRODUCTO " + _
                    " LEFT JOIN PPER ON PH.PPER = PPER.PPER " + _
                    " LEFT JOIN EJECUTOR EJEC ON EJEC.EJECUTOR = PH.EJECUTOR " + _
                    " LEFT JOIN PERSONA PM ON PM.PERSONA = PH.PERSONA_MONITOREO " + _
                    " LEFT JOIN PERSONA PE ON PE.PERSONA = PH.PERSONA_ESPECIALISTA  " + _
                    " LEFT JOIN UNIDAD  U ON  PH.UNIDAD = U.UNIDAD " + _
                    " LEFT JOIN UNIDAD U2 ON PH.UNIDAD2= U2.UNIDAD " + _
                    " LEFT JOIN UNIDAD U3 ON PH.UNIDAD3 = U3.UNIDAD " + _
                    " LEFT JOIN GENERAL GNRL ON PH.TIPO_CAMBIO_POA = GNRL.CODIGO AND GNRL.ID='TIPO_CAMBIO' " + _
                    "LEFT JOIN GENERAL GNRL2 ON PH.ESTADO = GNRL2.CODIGO AND GNRL2.ID='ESTADO_POA' " + _
                    " where poa='" + poa + "'"
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function modific_poaPrinc(ByVal poa As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Try
            objData.CreateInputOracle("v_POA", poa, 8)
            objData.CreateOutputOracle("p_Cursor", "", 100)
            objDt = objData.ExecuteOracle("SP_MOSTRAR_POA", "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaPOA(ByVal strPersona As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String
        Try
            lxc_SQL = "SELECT P.NOMBRE, P.ANHIO_FIRMA_POA, P.MONTO_TOTAL_INVERTIDO, G.DESCRIPCION || ' (' || P.VERSION ||')' AS TIPO_CAMBIO , P.MONTO_INV_ANHIO,PM.NOMBRES || ' ' || PM.APELLIDO_PATERNO || ' ' || PM.APELLIDO_MATERNO AS MONITOREADOR, PP.PPER, E.EJECUTOR, E.DESCRIPCION AS EJE_DES , " & _
                      "PE.NOMBRES || ' ' || PE.APELLIDO_PATERNO || ' ' || PE.APELLIDO_MATERNO AS ESPECIALISTA, P.OBJETIVO,P.SNIP,P.FECHA_VIABILIDAD, P.POA ,U.NOMBRE AS UBIGEO, TPA.DESCRIPCION,PP. ABREVIATURA,P.VERSION, P.ESTADO, P.ESTADO_REPROG FROM POA P " & _
                      "INNER JOIN TIPO_PROYECTO_ACTIVIDAD TPA ON TPA.TIPO_PROYECTO_ACTIVIDAD = P.TIPO_PROYECTO_ACTIVIDAD INNER JOIN PPER PP ON PP.PPER = P.PPER " & _
                      "LEFT JOIN PERSONA PM ON PM.PERSONA = P.PERSONA_MONITOREO " & _
                      "LEFT JOIN PERSONA PE ON PE.PERSONA = P.PERSONA_ESPECIALISTA " & _
                      "LEFT JOIN UBIGEO  U ON U.UBIGEO = P.UBIGEO " & _
                      "LEFT JOIN EJECUTOR E ON P.EJECUTOR = E.EJECUTOR  " & _
                      "LEFT JOIN GENERAL G ON G.CODIGO = P.TIPO_CAMBIO_POA WHERE G.ID = 'TIPO_CAMBIO' AND P.ANHIO_FIRMA_POA = '2013' "
            If strPersona = "" Then
                lxc_SQL = lxc_SQL & "ORDER BY P.POA "
            Else
                lxc_SQL = lxc_SQL & "AND '" & strPersona & "' IN (P.PERSONA_MONITOREO,P.PERSONA_ESPECIALISTA) ORDER BY P.POA "
            End If
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function Listaidcompohistory(ByVal compoH As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String
        Try
            lxc_SQL = "select ID_POA_COMPONENTE as ID from POA_COMPONENTE_HISTORICO where COMPONENTE ='" + compoH + "'"
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaPOA(ByVal strNombre As String, ByVal strPPER As String, ByVal strEjecutor As String, ByVal strPOA As String, ByVal stranhio As String, ByVal strPersona As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = "SELECT P.NOMBRE, P.ANHIO_FIRMA_POA, G.DESCRIPCION || ' (' || P.VERSION ||')' AS TIPO_CAMBIO, P.VERSION, P.MONTO_TOTAL_INVERTIDO, P.MONTO_INV_ANHIO,PM.NOMBRES || ' ' || PM.APELLIDO_PATERNO || ' ' || PM.APELLIDO_MATERNO AS MONITOREADOR, PP.PPER, E.EJECUTOR, E.DESCRIPCION AS EJE_DES , " & _
                      "PE.NOMBRES || ' ' || PE.APELLIDO_PATERNO || ' ' || PE.APELLIDO_MATERNO AS ESPECIALISTA, P.OBJETIVO,P.SNIP,P.FECHA_VIABILIDAD, P.POA ,U.NOMBRE AS UBIGEO, TPA.DESCRIPCION, PP.ABREVIATURA, P.ESTADO, P.ESTADO_REPROG FROM POA P " & _
                      "INNER JOIN TIPO_PROYECTO_ACTIVIDAD TPA ON TPA.TIPO_PROYECTO_ACTIVIDAD = P.TIPO_PROYECTO_ACTIVIDAD INNER JOIN PPER PP ON PP.PPER = P.PPER " & _
                      "LEFT JOIN PERSONA PM ON PM.PERSONA = P.PERSONA_MONITOREO " & _
                      "LEFT JOIN PERSONA PE ON PE.PERSONA = P.PERSONA_ESPECIALISTA " & _
                      "LEFT JOIN GENERAL G ON G.CODIGO = P.TIPO_CAMBIO_POA AND  G.ID = 'TIPO_CAMBIO'" & _
                      "LEFT JOIN UBIGEO  U ON U.UBIGEO = P.UBIGEO LEFT JOIN EJECUTOR E ON P.EJECUTOR = E.EJECUTOR WHERE 1 = 1  "
            If strNombre <> "" Then
                lxc_SQL = lxc_SQL & "AND UPPER(P.NOMBRE) like UPPER('%" & strNombre & "%')"
            End If
            If strPPER <> "" Then
                lxc_SQL = lxc_SQL & "AND PP.PPER = '" & strPPER & "'"
            End If
            If strEjecutor <> "" Then
                lxc_SQL = lxc_SQL & "AND P.EJECUTOR = '" & strEjecutor & "'"
            End If
            If strPOA <> "" Then
                lxc_SQL = lxc_SQL & "AND UPPER(P.POA) LIKE UPPER('%" & strPOA & "%')"
            End If

            If stranhio <> "all" Then
                lxc_SQL = lxc_SQL & "AND P.ANHIO_FIRMA_POA='" & stranhio & "'"
            End If


            If strPersona = "" Then
                lxc_SQL = lxc_SQL & "ORDER BY P.POA "
            Else
                lxc_SQL = lxc_SQL & "AND '" & strPersona & "' IN (P.PERSONA_MONITOREO,P.PERSONA_ESPECIALISTA) ORDER BY P.POA "
            End If
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function LISTA_COMPONENTE(ByVal poac As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try
            lxc_SQL = "SELECT ROWNUM || ' - ' || DESCRIPCION as descripcion2, componente, descripcion , version, sub_descripcion " + _
                    "FROM " + _
                        "( " + _
                            "SELECT Descripcion, componente,  version, sub_descripcion from poa_actividad_componente " + _
                            "WHERE poa ='" + poac + "' " + _
                            "ORDER BY  TO_NUMBER(componente)  ASC " + _
                            ")"

            'Sustituido por Sandro 18/03/2013
            'lxc_SQL = " select ROWNUM || ' - ' || DESCRIPCION as descripcion2, componente, descripcion , version, sub_descripcion from poa_actividad_componente" + _
            '          " where poa ='" + poac + "' " + _
            '          "order by  componente "

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function lista_GENERICA() As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = " SELECT GENERICA_GASTOS, GENERICA_GASTOS ||'  '|| UPPER(DESCRIPCION)  as DESCRIPCION FROM GENERICA_GASTOS ORDER BY GENERICA_GASTOS"

            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function lista_ESPECIFICA(ByVal generica As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String

        Try

            lxc_SQL = " SELECT ESPECIFICA_GASTO,  DESCRIPCION AS DESCRIPCION  FROM ESPECIFICA_GASTO " + _
                      " WHERE GENERICA_GASTO='" + generica + "' ORDER BY ESPECIFICA_GASTO "
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt

        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function lista_ESPECIFICA2(ByVal generica As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String
        Try
            '" SUBSTR(ESPECIFICA_GASTO || '                   ',1,20) || ' - '|| DESCRIPCION AS DESCRIPCION2 " + _


            '" CASE LENGTH(ESPECIFICA_GASTO) " + _
            ' " WHEN 5 THEN ESPECIFICA_GASTO || ' ' || ' ' || ' ' || ' ' || ' ' || ' ' || ' ' ||  ' ' || DESCRIPCION " + _
            ' " WHEN 6 THEN ESPECIFICA_GASTO || ' ' || ' ' || ' ' || ' ' || ' ' || ' ' || ' ' || DESCRIPCION " + _
            ' " WHEN 7 THEN ESPECIFICA_GASTO || ' ' || ' ' || ' ' || ' ' || ' ' || ' ' || DESCRIPCION " + _
            ' " WHEN 8 THEN ESPECIFICA_GASTO || ' ' || ' ' || ' ' || ' ' || ' ' || DESCRIPCION " + _
            ' " WHEN 9 THEN ESPECIFICA_GASTO || ' ' || ' ' || ' ' || ' ' || DESCRIPCION " + _
            ' " WHEN 10 THEN ESPECIFICA_GASTO || ' ' || ' ' || ' ' || DESCRIPCION " + _
            ' " WHEN 11 THEN ESPECIFICA_GASTO || ' ' || ' ' || DESCRIPCION " + _
            ' " END AS DESCRIPCION2 " + _


            lxc_SQL = " SELECT ESPECIFICA_GASTO,  DESCRIPCION AS DESCRIPCION, " + _
                      " SUBSTR(ESPECIFICA_GASTO || '                   ',1,20) || ' - '|| DESCRIPCION AS DESCRIPCION2 " + _
                      " FROM ESPECIFICA_GASTO " + _
                      " WHERE GENERICA_GASTO='" + generica + "' ORDER BY ESPECIFICA_GASTO "
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw
        End Try
    End Function

    Public Function CargarGrillaComponente(ByVal poa As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        Dim lxc_SQL As String
        Try
            lxc_SQL = "SELECT P.POA," + _
                      "COMPONENTE AS CODIGO," + _
                      "DESCRIPCION AS COMPONENTE," + _
                      "SUB_DESCRIPCION," + _
                      "C.VERSION," + _
                      "PESO_COMPONENTE " + _
                      "FROM POA_ACTIVIDAD_COMPONENTE C " + _
                      "INNER JOIN POA P " + _
                      "ON P.POA = C.POA " + _
                      "WHERE P.VERSION = C.VERSION " + _
                      "  AND P.POA = '" + poa + "' ORDER BY TO_NUMBER(CODIGO)"
            objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargarGrillafisico(ByVal poa As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        'Dim lxc_SQL As String
        Try
            objData.CreateInputOracle("v_POA", poa, 8)
            objData.CreateOutputOracle("p_Cursor", "", 100)
            objDt = objData.ExecuteOracle("SP_MOSTRAR_POA_ACT_FISICA", "Conexion.Oracle")

            'lxc_SQL = " SELECT P.SNIP," + _
            '          "  P.TIPO_PROYECTO_ACTIVIDAD, " + _
            '          "  PAF.POA," + _
            '          "  NVL (PAF.META_01, 0) META_01," + _
            '          "  NVL (PAF.META_02, 0) META_02," + _
            '          "  NVL (PAF.META_03, 0) META_03," + _
            '          "  NVL (PAF.META_04, 0) META_04," + _
            '          "  NVL (PAF.META_05, 0) META_05," + _
            '          "  NVL (PAF.META_06, 0) META_06," + _
            '          "  NVL (PAF.META_07, 0) META_07," + _
            '          "  NVL (PAF.META_08, 0) META_08," + _
            '          "  NVL (PAF.META_09, 0) META_09," + _
            '          "  NVL (PAF.META_10, 0) META_10," + _
            '          "  NVL (PAF.META_11, 0) META_11," + _
            '          "  NVL (PAF.META_12, 0) META_12," + _
            '          "  NVL (PAF.META_ANUAL, 0) META_ANUAL," + _
            '          "  PAF.UNIDAD," + _
            '          "  U.DESCRIPCION AS UNIDADES," + _
            '          "  PAF.TAREA_ACTIVIDAD," + _
            '          "  PAF.TAREA_ACTIVIDAD_DESCRIPCION AS tarea," + _
            '          "  PAF.ID_POA_ACTIVIDAD_FISICA," + _
            '          "  PAF.COMPONENTE," + _
            '          "  PAF.VERSION," + _
            '          "  PAC.DESCRIPCION AS COMPONENTEDES," + _
            '          "  PAF.PESO, " + _
            '          "  PAF.CODIGO " + _
            '          "  FROM POA_ACTIVIDAD_FISICA PAF" + _
            '          "  LEFT JOIN UNIDAD U" + _
            '          "     ON U.UNIDAD = PAF.UNIDAD" + _
            '          "  INNER JOIN POA_ACTIVIDAD_COMPONENTE PAC" + _
            '          "     ON PAC.COMPONENTE = PAF.COMPONENTE" + _
            '          "  INNER JOIN POA P" + _
            '          "     ON P.POA = PAF.POA" + _
            '          "  WHERE PAF.poa = '" + poa + "'" + _
            '          "  AND P.VERSION = PAF.VERSION" + _
            '          "  ORDER BY " + _
            '                " TO_NUMBER(NVL2(REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,1), REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,1), 0)) ASC, " + _
            '                " TO_NUMBER(NVL2(REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,2), REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,2), 0)) ASC, " + _
            '                " TO_NUMBER(NVL2(REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,3), REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,3), 0)) ASC, " + _
            '                " TO_NUMBER(NVL2(REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,4), REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,4), 0)) ASC, " + _
            '                " TO_NUMBER(NVL2(REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,5), REGEXP_SUBSTR(PAF.CODIGO,'[^._]+',1,5), 0)) ASC "

            'objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargarGrillafinanciero(ByVal poa As String) As DataTable
        Dim objData As AdministradorOracle = New AdministradorOracle
        Dim objDt As DataTable
        'Dim lxc_SQL As String
        Try
            objData.CreateInputOracle("v_POA", poa, 8)
            objData.CreateOutputOracle("p_Cursor", "", 100)
            objDt = objData.ExecuteOracle("SP_MOSTRAR_POA_ACT_FINANCIERA", "Conexion.Oracle")

            'lxc_SQL = "SELECT PAFN.POA," + _
            '        "  PAFN.version," + _
            '        "  GG.GENERICA_GASTOS AS GENERICA_GASTO," + _
            '        "  EG.ESPECIFICA_GASTO," + _
            '        "  GG.GENERICA_GASTOS || ' ' || GG.DESCRIPCION AS GENERICA_GASTODES," + _
            '        "  EG.DESCRIPCION AS ESPECIFICA_GASTODES," + _
            '        "  PAFN.ID_POA_ACTIVIDAD_FINANCIERA," + _
            '        "  PAFN.POA," + _
            '        "  NVL (PAFN.META_01, 0) META_01," + _
            '        "  NVL (PAFN.META_02, 0) META_02," + _
            '        "  NVL (PAFN.META_03, 0) META_03," + _
            '        "  NVL (PAFN.META_04, 0) META_04," + _
            '        "  NVL (PAFN.META_05, 0) META_05," + _
            '        "  NVL (PAFN.META_06, 0) META_06," + _
            '        "  NVL (PAFN.META_07, 0) META_07," + _
            '        "  NVL (PAFN.META_08, 0) META_08," + _
            '        "  NVL (PAFN.META_09, 0) META_09," + _
            '        "  NVL (PAFN.META_10, 0) META_10," + _
            '        "  NVL (PAFN.META_11, 0) META_11," + _
            '        "  NVL (PAFN.META_12, 0) META_12," + _
            '        "  NVL (PAFN.META_ANUAL, 0) META_ANUAL," + _
            '        "  PAFN.ID_POA_ACTIVIDAD_FINANCIERA" + _
            '        "  FROM POA_ACTIVIDAD_FINANCIERA PAFN " + _
            '        "  LEFT JOIN GENERICA_GASTOS GG" + _
            '        "     ON PAFN.GENERICA_GASTO = GG.GENERICA_GASTOS" + _
            '        "  LEFT JOIN ESPECIFICA_GASTO EG" + _
            '        "     ON PAFN.ESPECIFICA_GASTO = EG.ESPECIFICA_GASTO" + _
            '        "  INNER JOIN POA P" + _
            '        "     ON P.POA = PAFN.POA" + _
            '        " WHERE PAFN.POA = '" + poa + "'" + _
            '        " AND P.VERSION = PAFN.VERSION ORDER BY EG.ESPECIFICA_GASTO"
            'objDt = objData.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function TipoTransferencia() As DataTable
        Dim objdata As AdministradorOracle = New AdministradorOracle
        Dim obdt As DataTable
        Dim lxc_SQL As String
        Try
            lxc_SQL = "select GRAL.CODIGO,GRAL.DESCRIPCION " & _
                      "from general gral " & _
                      "where id='TIPO_ASIGNACION_RECURSO' "

            obdt = objdata.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return obdt
        Catch ex As Exception
            Throw ex
        End Try

    End Function

    Public Function TipoProyectoDES() As DataTable
        Dim objdata As AdministradorOracle = New AdministradorOracle
        Dim objdt As DataTable
        Dim lxc_SQL As String

        Try
            lxc_SQL = "select GRAL.CODIGO,GRAL.DESCRIPCION " & _
                      "from general gral " & _
                      "where id='TIPO_PROYECTO_DES' "

            objdt = objdata.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objdt
        Catch ex As Exception
            Throw ex
        End Try

    End Function

    Public Function ExistenciaComponente(ByVal strcomponente As Integer) As DataTable
        Dim objdata As AdministradorOracle = New AdministradorOracle
        Dim objdt As DataTable
        Dim lxc_sql As String
        Try
            lxc_sql = "SELECT PAF.ID_POA_ACTIVIDAD_FISICA,PAF.COMPONENTE " & _
                      "FROM POA_ACTIVIDAD_FISICA PAF " & _
                      "WHERE PAF.COMPONENTE='" & strcomponente & "'"
            objdt = objdata.ExecuteSQL(lxc_sql, "Conexion.Oracle")
            Return objdt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargaComponenteEdicion(ByVal strPOA As String, ByVal strVersion As String) As DataTable
        Dim objdata As AdministradorOracle = New AdministradorOracle
        Dim objdt As DataTable
        Dim lxc_SQL As String

        Try
            lxc_SQL = "SELECT CODIGO, COMPONENTE, DESCRIPCION " & _
                      " FROM POA_ACTIVIDAD_COMPONENTE " & _
                      " WHERE POA = '" & strPOA & "' " & _
                      " AND VERSION = '" & strVersion & "' " & _
                      " ORDER BY TO_NUMBER(COMPONENTE), CODIGO ASC"
            '" ORDER BY TO_NUMBER(CODIGO),COMPONENTE " Antes 18/03/2013
            objdt = objdata.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objdt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargaFisicoEdicion(ByVal strPOA As String, ByVal strVersion As String) As DataTable
        Dim objdata As AdministradorOracle = New AdministradorOracle
        Dim objdt As DataTable
        Dim lxc_SQL As String

        Try
            lxc_SQL = "SELECT C.CODIGO AS COD_COM, C.COMPONENTE, " & _
                      "C.DESCRIPCION, F.CODIGO AS COD_FIS, " & _
                      " F.TAREA_ACTIVIDAD_DESCRIPCION, F.ID_POA_ACTIVIDAD_FISICA " & _
                      " FROM POA_ACTIVIDAD_FISICA F " & _
                      " INNER JOIN POA_ACTIVIDAD_COMPONENTE C " & _
                      " ON C.COMPONENTE = F.COMPONENTE " & _
                      " WHERE F.POA = '" & strPOA & "' " & _
                      " AND F.VERSION = '" & strVersion & "' " & _
                      " ORDER BY TO_NUMBER(C.CODIGO), F.CODIGO "
            objdt = objdata.ExecuteSQL(lxc_SQL, "Conexion.Oracle")
            Return objdt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub EditarCodigoComponente(ByVal strCodigo As String, ByVal strComponente As String, ByVal strPOA As String, ByVal strVersion As String)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try
            objData.CreateInputOracle("COD", strCodigo, 10)
            objData.CreateInputOracle("POAC", strPOA, 10)
            objData.CreateInputOracle("VER", strVersion, 2)
            objData.CreateInputOracle("COM", strComponente, 10)
            objData.ExecuteOracle_NonQuery("EDITA_CODIGO_COMP", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub EditarCodigoFisico(ByVal strComponente As String, ByVal strPOA As String, ByVal strIPAF As String, ByVal strVersion As String, ByVal strCodigo As String)
        Dim objData As AdministradorOracle = New AdministradorOracle
        Try
            objData.CreateInputOracle("COM", strComponente, 10)
            objData.CreateInputOracle("POAC", strPOA, 10)
            objData.CreateInputOracle("IPAF", strIPAF, 10)
            objData.CreateInputOracle("VER", strVersion, 2)
            objData.CreateInputOracle("COD", strCodigo, 10)
            objData.ExecuteOracle_NonQuery("EDITA_CODIGO_FIS", "Conexion.Oracle")
        Catch ex As Exception
            Throw ex
        End Try
    End Sub
End Class
